 {include file="index@public/header" /}
<style type="text/css">
  ::-webkit-scrollbar{
    width:8px;
    height: 6px;
  }
  ::-webkit-scrollbar-thumb{
    border-radius: 10px;
    box-shadow: 0 0 1px rgb(255 255 255 / 50%);
    background-color: rgba(0, 0, 0, .2);
  }
  ::-webkit-scrollbar-track-piece{
    border-radius: 10px;
    box-shadow: 0 0 1px rgb(255 255 255 / 50%);
    background-color: #ededed;
  }
  
  @media screen and (min-width: 768px) {
    .pc-list{display: block;}
    .phone-list{display: none;}
    .phone-balllist-tab{display: none;}
  }
  @media screen and (max-width: 900px) {
      .pc-list{display: none;}
      .phone-list{display: block;}
      .phone-balllist-tab{display: block;}
      #list-phone-add tr{line-height: 25px;}
  }
  
  .selall img{float: left;margin-top:2px;}
  .selzhi{
    color:#36648a;text-decoration:none;font: 12px/14px arial,helvetica,sans-serif;
    display: inline-block;
    width:100%;
    float: left;
  }
  /*.selzhi:hover{
     background-color: #36648a;
  }*/
  /*.selall:hover{
    background-color: #36648a;
  }*/
  .selall:hover{
    background-color: #36648a;
  }
  .selall:hover a{
    color: #ffffff;
  }
  body{background-color:#ffffff}
  .gaol{background-color: #EFEFEF;}
  .delail_list{margin-top:10px;cursor:pointer;}
  .Part_No {color:#36648a;}
  .delail_list .price-a{color:#19792f}
  .delail_list:hover{background-color: #36648a;}
  .delail_list:hover div {color:#ffffff;background-color: #36648a;}

          
          .balllist .balllist-a a{display:block;}
          .balllist .balllist-a a:hover{color:#36648A;}
          .balllist .balllist-a a:hover .plist{border:1px solid #36648A;}
          .balllist-a{
            padding: 5px 8px;
            font-family: Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
          }
          .balllist-h{
            margin-left: 5px;
            padding-bottom:2px;
          }
          
          .plist{
            height: 120px;
            border:1px solid #ccc;
            border-radius: 8px;
            padding:10px 5px 5px 5px;
            display: flex;
          }
          .plist-left{
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
          }
          .plist-right{
            flex:3;
            overflow: hidden;
            text-overflow: ellipsis;
          }
          .plist-title{
            width: 100%;
            padding-bottom: 5px;
            font: 14px/16px Titillium Web,sans-serif;
          }
          
          .plist-desc{
            color: #333;
            
            line-height:16px;
          }
          .plist-icon img{
            max-width: 75%;
            object-fit: contain;
            object-position: 50% 50%;
          }
          .balllist a{text-decoration:none;}

          @media screen and (max-width:768px) {
            .balllist .balllist-a .plist{padding:3px;}
            .balllist .balllist-a .plist .plist-title{padding-bottom:2px;font-size:14px}
          }
          .layui-flow-more {position:absolute;left: calc(50% - 60px);width:120px;}
          #demo3 {margin-top:27px;display: flex;justify-content: center;}
          #demo3 .layui-laypage .layui-laypage-curr .layui-laypage-em{background-color: #36648a;}
         

            /*分页*/
            .pagination{height: 20px;line-height:20px;}
            .pagination li { float: left;text-align:center;cursor:pointer; padding: 0px 5px;}
            .pagination li a{width:100%;height:100%;display:inline-block;text-decoration: none;}
            
            .pagination .disabled{color:#e2e2e2}
            .pagination .active{text-decoration: underline;}

        </style>

<div class='phone-list' style='font: 12px/14px arial,helvetica,sans-serif;margin-top: -25px;padding:10px;'>
<div class='firstbreadcrumb' style="padding: 10px;">
  {foreach $crumbs as $k=>$v }
    <?php if($k!=count($crumbs)-1){?>
    <a href="/{$v['crumbs_url']}" style="font: 14px arial,helvetica,sans-serif;color:#36648A;padding-right: 8px;display: inline-block;height: 48px;line-height: 48px">{$v['alias_name']}</a> <span style="padding-right:8px;padding-bottom: 8px;display: inline-block;"> / </span>
    <?php }else{ ?>
    <span style="font: 14px arial,helvetica,sans-serif;color: #666;"><cite>{$class_info['alias_name']}</cite></span> 
    <?php } ?>  
  {/foreach} 
</div>

 
  
  <div style="padding:12px 0px">
    <div>
      <h1 style="font-size:16px;font-weight:bold;">{$class_info['alias_name']}</h1>
    </div>
    <div style="padding:3px 0px">
      
      {foreach $listkey as $key=>$vo }

      <?php if($vo['wname']=='Bore Dia'||$vo['wname']=='Outer Dia'||$vo['wname']=='Width'){?>
      <?php if(!empty($vo['data'])){?>
      <select aria-label="{$vo['wname']}" style="width:24%;height:48px;line-height: 48px;" onchange="window.location=this.value">
        <option>{:lang(trim($vo['wname']))}</option>
        {foreach $vo['data'] as $k1=>$v1 }
        <?php if(!empty($v1['key'])&&$v1['key']!=''){ ?>

        <?php 
          if($vo['is_nosearch']==1){
            $nosearch=Db::table('lily_listkey_nosearch')->field('url')->where([['list_key_id','=',$vo['id']],['value','=',$v1['key']]])->find();
            if(!empty($nosearch)){
              $shai_url=$nosearch['url'];
            }else{
              $shai_url='';
            }
          }else{
            if(empty($get)){
                $shai_url=$base_data['no_parameter_url'].'?'.trim(str_replace(' ','_',$vo['wname'])).'='.trim($v1['key']);
            }else{
                $shai_url=$base_data['no_parameter_url'].'?';
                foreach ($get as $getkey => $getvalue) {
                    if($getkey=='part_number'){ $getkey='p';}
                      if($getkey!=str_replace(' ','_',$vo['wname'])){
                          $shai_url.=$getkey.'='.$getvalue.'&';
                      }
                }
                if(isset($get[str_replace(' ','_',$vo['wname'])]) && $get[str_replace(' ','_',$vo['wname'])]==$v1['key']){
                    $shai_url=rtrim(rtrim($shai_url,'&'),'?');
                }else{
                    $shai_url=$shai_url.trim(str_replace(' ','_',$vo['wname'])).'='.trim($v1['key']);
                }
            }
          } ?>
           
          <?php if(isset($get[str_replace(' ','_',$vo['wname'])]) && $get[str_replace(' ','_',$vo['wname'])]==$v1['key'] ){?>
          <option value="{$shai_url}" selected="selected">{:lang($v1['key'])}</option>
          <?php }else{ ?>
          <option value="{$shai_url}">{:lang($v1['key'])}</option>
          <?php } ?>
            
         
        <?php }?>
        {/foreach}
        
      </select>
      <?php } ?>
      <?php } ?>
      {/foreach}
      
      <div style="width:25%;float:right;">
        <button style="height:48px;line-height: 48px;width:100%;" style="button" id="select_more_wd_a">更多筛选</button>
        <button style="height:48px;line-height: 48px;width:100%;display:none;" style="button" id="select_more_wd_b">关闭筛选</button>
      </div>
      
      <div class='clear'></div>
      <div style='display:none;' id="more_wd">
        <div style='width:100%;border:1px solid black;background-color:#efefef;padding:2px 0px;color:#333333;max-height:100px;overflow-x: hidden;;overflow-y:auto;z-index:10;font-size:14px;'>
          {foreach $listkey as $key=>$vo }
          <?php if($vo['wname']!='Bore_Dia'&&$vo['wname']!='Outer_Dia'&&$vo['wname']!='Width'){?>
          <?php if(!empty($vo['data'])){?>
          <select aria-label="{$vo['wname']}" style="height:48px;line-height: 48px;margin:3px 0px;" onchange="window.location=this.value">
            <option>{:lang(trim($vo['wname']))}</option>
            {foreach $vo['data'] as $k1=>$v1 }
            <?php if(!empty($v1['key'])&&$v1['key']!=''){ ?>
            <?php 
              if($vo['is_nosearch']==1){
                $nosearch=Db::table('lily_listkey_nosearch')->field('url')->where([['list_key_id','=',$vo['id']],['value','=',$v1['key']]])->find();
                if(!empty($nosearch)){
                  $shai_url=$nosearch['url'];
                }else{
                  $shai_url='';
                }
              }else{
                if(empty($get)){
                    $shai_url=$base_data['no_parameter_url'].'?'.trim(str_replace(' ','_',$vo['wname'])).'='.trim($v1['key']);
                }else{
                    $shai_url=$base_data['no_parameter_url'].'?';
                    foreach ($get as $getkey => $getvalue) {
                        if($getkey=='part_number'){ $getkey='p';}
                          if($getkey!=str_replace(' ','_',$vo['wname'])){
                              $shai_url.=$getkey.'='.$getvalue.'&';
                          }
                    }
                    if(isset($get[str_replace(' ','_',$vo['wname'])]) && $get[str_replace(' ','_',$vo['wname'])]==$v1['key']){
                        $shai_url=rtrim(rtrim($shai_url,'&'),'?');
                    }else{
                        $shai_url=$shai_url.trim(str_replace(' ','_',$vo['wname'])).'='.trim($v1['key']);
                      }
                  }
               }?>
          
            <?php if(isset($get[str_replace(' ','_',$vo['wname'])]) && $get[str_replace(' ','_',$vo['wname'])]==$v1['key']){?>
                      <option value="{$shai_url}" selected="selected">{:lang($v1['key'])}</option>
            <?php }else{ ?>
            <option value="{$shai_url}">{:lang($v1['key'])}</option>
            <?php } ?>

            <?php }?>
        {/foreach}
          </select>
          <?php } ?>
          <?php } ?>
          {/foreach}
        </div>
      </div>
      <?php if(!empty($get)){?>
      <div style="font-size:14px;">
        {foreach $get as $key=>$vo }
         <?php 
            if($key=='part_number'){ 
              $key='Part_Number'; 
            }
          ?>
        <button style="color:#333;margin:5px 5px 5px 0px;height:48px;line-height: 48px;" onclick="del_search('{$key}','{$vo}')">{:lang(str_replace('_',' ',$key))}:{:lang($vo)} <i class="layui-icon layui-icon-close" style="font-size:12px"></i></button>
        {/foreach}
        <button style="color:#36648a;margin:3px 0px;height:48px;line-height: 48px;" onclick="clearall()">清空</button>
      </div>
    <?php } ?>
       
     
      <div style="font-size:14px" class='phone-balllist-tab'>
        {foreach $table_products as $key=>$value }
        <div style="overflow-x: hidden;background-color:#ffffff;margin-bottom:20px;">
          <table width="100%" border="0" cellspacing="1" cellpadding="1" align="left" style="margin-bottom: 20px">
            <caption style="text-align:left;padding:5px 0px;background-color:#ffffff;height:25px;line-height:25px;position:sticky;top:0px;position:-webkit-sticky;z-index:10;">
              <a href="/{$value['class']['url']}">{$value['class']['alias_name']}</a> 
            </caption>
            <tr style="background-color:#efefef;">
              <?php $table_title = array_slice($value['table_title'], 0, 3);?>
              <th style="color:#333;padding: 5px 2px;font-size: 16px;">型号</th>
              {foreach $table_title as $k=>$v }
              <th style="color:#333;padding: 5px 2px;font-size: 16px;">{:strip_tags($v)}</th>
              {/foreach}
            </tr>
            <tbody id='list-phone-add'>
          
               {foreach $value['detail'] as $k=>$v }
               <?php $sk=0;?>
              <tr>
                <td style="padding: 1px 2px;font-size: 14px;"><a style="display:block;" href="/products/{$v['url_product']}/">{$v['part_number']}</a></td>
                {foreach $v as $k1=>$v1 }
                <?php if($k1!='part_number'&&$k1!='pid'&&$sk<=2){?>
                <?php if(!empty($v1)){ ?>
                
                <td style="padding: 1px 2px;font-size: 14px;">{:lang($v1)}</td>
                <?php }else{ ?>
                <td style="padding: 1px 2px;font-size: 14px;">-</td>
                <?php } ?>
                <?php $sk++; ?>
                <?php } ?>
               {/foreach}
              </tr>
              {/foreach}
            
            </tbody>
          </table>
      </div>
      {/foreach}
      

    </div>
  </div>
</div>


{include file="index@public/footer" /}
<script>
  layui.use("element", function () {
    var element = layui.element;
        
  });
  var LAY_demo1_width=$("#LAY_demo1").width();
  $('#demo3').width(LAY_demo1_width);
</script>

<script type="text/javascript">
 $(document).ready(function(){
  $("#deltail_des_a").click(function(){
    $("#deltail_des_c").show();
    $("#deltail_des_a").hide();
    $("#deltail_des_b").show();
  });
  $("#deltail_des_b").click(function(){
    $("#deltail_des_c").hide();
    $("#deltail_des_a").show();
    $("#deltail_des_b").hide();
  });

  $("#select_more_wd_a").click(function(){
    $("#more_wd").show();
    $("#select_more_wd_a").hide();
    $("#select_more_wd_b").show();
  });
  $("#select_more_wd_b").click(function(){
    $("#more_wd").hide();
    $("#select_more_wd_a").show();
    $("#select_more_wd_b").hide();
  });
});


function clearall() {
    layer.load(1, {
      shade: [0.1, '#fff'],
      success: function() {
        setTimeout(function() {
          var url = window.location.href; //获取当前页面的url
          if (url.indexOf("?") != -1) { //判断是否存在参数
            url = url.replace(/(\?|#)[^'"]*/, ''); //去除参数
          }
          window.location.href = url;
        }, 1000);
      }
  });
}

/*单个清空*/
function del_search($k, $v) {
    if($k=='Part_Number'){
      $k='p';
    }
    var url = window.location.href; //获取当前页面的url
    let arrUrl = [];
    let changUrl = ''
    if (url.indexOf("?") != -1) { //判断是否存在参数
      arrUrl = url.split('?')[1].split('&')
      //获取参数转换为object
      for (var i = 0; i < arrUrl.length; i++) {
        arrUrl[i] = arrUrl[i].split("=");
      };
      for (var i = 0; i < arrUrl.length; i++) {
        if(arrUrl[i][0]==encodeURI($k)){
                    arrUrl.splice(i,1);
        }
      }
      if(arrUrl.length == 0){
        url = url.split('?')[0];
      }else{
        for (var i = 0; i < arrUrl.length; i++) {
          changUrl+=arrUrl[i][0]+'='+arrUrl[i][1]+'&';
        }

        url=url.split('?')[0]+'?'+changUrl.slice(0, changUrl.length - 1);
      }
      window.location.href=url;
    }
}

</script>
